//
// Created by baoch on 2024/12/18.
//
#include<stdio.h>
#include<stdlib.h>
//定义一个节点
struct num
{
    int data;
    struct num* next;
};
struct num * HEAD()//申请头节点
{
    struct num* head = (struct num*)malloc(sizeof(struct num));
    head -> next = NULL;
    return head;
}
int main()
{
    int n;
    scanf("%d",&n);
    int arr[n];
    for(int i = 0;i < n;i++)
    {
        scanf("%d ",&arr[i]);
    }
    struct num * head = HEAD();//申请头节点
    struct num * tail = head;

    for(int i = 0;i < n;i++)
    {
        struct num* current = (struct num*)malloc(sizeof(struct num));//创建一个新指针
        current -> data = arr[i];
        tail -> next = current;
        tail = tail -> next;

    }
    struct num *p = head -> next;//重新定义一个指针变量遍历链表
    while(p != NULL)//遍历链表
    {
        printf("%d ",p -> data);
        p = p -> next;
    }
}